<template>
  <a-modal v-model="visible" title="原因备注" :width="700" centered @ok="handleSubmit" destroyOnClose class="return-modal">
    <a-form>
      <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="备注原因：" required>
        <a-select v-model="reason" placeholder="请选择">
          <a-select-option :value="item.value" v-for="(item, index) in reasonList" :key="index">{{ item.text }}</a-select-option>
        </a-select>
      </a-form-item>
    </a-form>
  </a-modal>
</template>
<script>
import { setNoPayReason } from '@/api/box/order'
export default {
  props: ['reasonList'],
  data() {
    return {
      visible: false,
      labelCol: {
        xs: { span: 4 },
        sm: { span: 3 }
      },
      wrapperCol: {
        xs: { span: 12 },
        sm: { span: 12 }
      },
      reason: '',
      boxId: ''
    }
  },
  methods: {
    show(id, reason) {
      this.visible = true
      this.reason = reason
      this.boxId = id
    },
    handleSubmit() {
      console.log(this.reason)
      let params = {
        requestData: {
          noPayReason: this.reason,
          id: this.boxId
        }
      }
      setNoPayReason(params).then(res => {
        if (res.code == 0) {
          this.$message.success('提交成功！')
          this.visible = false
          this.$emit('updateDetail')
        } else {
          this.$message.warning(res.msg)
        }
      })
    }
  }
}
</script>
<style src="../less/modal.less" lang="less" scoped></style>
